
$(function(){
	
	$("#login").validationEngine({
		
		promptPosition: "topRight", // OPENNING BOX POSITION, IMPLEMENTED: topLeft, topRight, bottomLeft,  centerRight, bottomRight
		success :  false,
		failure : function(){alert("aaa");}
	});
	$("input[type!=button]").keypress(function(e){
	  if(e.keyCode == 13){
		return false;
	  }
	});
	$("#adminLogin").click(function(){
		if(!$.validationEngine.submitValidation("#login")){
			var username = $("#username").val();
			var password = $("#password").val();
			var url = 'adminLogin.action';
			//var basepath = '${path}';
			$.post(url, 
					{"username":username,"password":password}, 
					function(data){
						if(data == true){
							window.location = 'preArticleWrite';
						}else{
							$.validationEngine.buildPrompt("#username",$("#errorLogin").text(),"error");
							setTimeout(function(){
								$(".formError").fadeOut(2000);
								setTimeout(function(){
									$(".formError").remove();
									
								},2000);
							},2000);
							
						}
					}, 
					'json'
			);
		}
	});
	
	
});